<template>
    <table class="table table-bordered"> 
        <tr>
                <th>手机号</th>
                <th>
                    <input type="text" v-model="aa.Phone">
                </th>

        </tr>


        <tr>
                <th>密码</th>
                <th>
                    <input type="password"  v-model="aa.Pwd">
                </th>

        </tr>

        <tr>
                <th></th>
                <th>
                   <button @click="login">登陆</button>
                </th>

        </tr>


    </table>



</template>


<script setup lang="ts">


 import axios from 'axios';
import {ref} from'vue';

import{ useCounterStore} from '../stores/use'
import { useRoute, useRouter } from 'vue-router';
const aa =ref({

    Phone:"",
    Pwd:"",

})


const Userstore =useCounterStore();
const router =useRouter();
const login=()=>{


    axios.get('https://localhost:7288/api/Login/Login',{params:{
        Phone:aa.value.Phone,
        Pwd:aa.value.Pwd,





    }}).then(res=>{
      
        if(res.data.id>0)
    {
        alert('登陆成功')

        Userstore.aa= res.data.shiti.mname;
        router.push('/ShowZhiwei')



    }
    else if(res.data.id==-1)
    {
        alert('手机号不存在')
    }
    else if(res.data.id==-2)
    {
        alert('密码错误')
    }

    })

}





</script>